{%include file="index.header.tpl.php"%}
{%include file="index.left.tpl.php"%}
  <!--主要内容开始-->
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
        <section class="col-lg-12 connectedSortable">
         <div class="box box-default box-solid" style="padding-top:10px;">
			 <form action="" method="get">
				 <div class="col-md-3 form-group">
					 <label for="inputPassword3" class="col-sm-4 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500; margin:0;">
						 学年学期：
					 </label>
					 <div class="input-group col-md-8 col-xs-12">
						 <select class="form-control" name="semester_id" id="semester_id">
							 <option value="">请选择</option>
							 {%foreach from=$semester_lists key=key item=value%}
							 <option value="{%$value.semester_id%}"{%if $value.semester_id==$semester_id %}selected{%/if%}>{%$value.semester_xname%}{%$value.semester_name%}</option>
							 {%/foreach%}
						 </select>
					 </div>
				 </div>
				 <div class="col-md-3 form-group">
					 <label for="inputPassword3" class="col-sm-4 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500; margin:0;">
						 月份：
					 </label>
					 <div class="input-group col-md-8 col-xs-12">
						 <select class="form-control" id="semester_month" name="month_id">
						 </select>
					 </div>
				 </div>
				 <input type="hidden" name="a" value="absent.stat">
				 <button type="submit" class="btn btn-warning">查 询</button>
			 </form>
		    <form action="" method="post">
                <div class="box-header with-border" style="clear:both">
                    <span class="fa fa-list" style="float:left; font-size:18px; margin-top:2px; color:#3c8dbc;" ></span>
                    <p class="box-title">代课汇总表</p>
                </div>
                    <div class="box-body">
                      <table class="table table-bordered table-condensed">   
                             <tr>
								<td rowspan="2">姓名</td>
								{%foreach from=$week_lists key=key item=value%}
								<td colspan="{%$free_count%}" align="center">第{%$value.week_number%}周</td>
								{%/foreach%}
								<td rowspan="2">请假合计</td>
								<td rowspan="2">代课合计</td>
							 </tr>
                             <tr>
							 {%foreach from=$week_lists key=key item=value%}
								{%foreach from=$free key=key item=value%}
								<td>{%$value%}</td>
								{%/foreach%}
								<td>代课</td>
							 {%/foreach%}
							 </tr>
							 {%foreach from=$data_lists key=key item=value%}
                             <tr>
								<td>{%$key%}</td>
								{%foreach from=$value.data key=k item=v%}
									{%foreach from=$v.item key=t item=s%}
									<td>{%$s%}</td>									
									{%/foreach%}
									<td>{%$v.absent%}</td>
								{%/foreach%}
								<td>{%$value.item_all%}</td>
								<td>{%$value.absent_all%}</td>
							 </tr>
							 {%/foreach%}
						 </table>             	   
				    </div><!--box-body --> 
				</form>
             </div><!--box box-default box-solid-->
        </section>   
           
        </div><!--row-->
    </section>
 </div>
  <!--主要内容结束-->
 {%include file="index.footer.tpl.php"%}

<script type="text/javascript">
	$(document).ready(function () {
		$("#semester_id").change(function () {
			if ($(this).val() == "-1") {
				$("#industr").remove(); return;
			}
			else {
				var timestamp = new Date().getTime();
				$.ajax({
					url:"index.php?a=semester.MonthJson",
					type:"get",
					data: "semester_id=" + $("#semester_id").find("option:selected").val() + "&timestamp=" + timestamp,
					dataType:"json",
					success:function(msg){

						//实例2个字符串变量来拼接下拉列表
						var industr = "";
						//使用jquery解析json中的数据
						$.each(msg, function (n, value) {
							industr += ("<option value=\"" + value.semester_month + "\">" + value.semester_month);
							industr += ("</option>");
						});

						$("#semester_month").html(industr);
					}
				});

			}

		});

	});
</script>